package study.websocket;

import org.glassfish.tyrus.server.Server;
import study.websocket.server.服务端.WebSocketServer2;


public class 运行服务端2 {
    public static void main(String[] args) {
        // 配置嵌入式 WebSocket 服务器
        Server server = new Server("localhost", 8083, "/",null, WebSocketServer2.class);

        try {
            System.out.println("Starting WebSocket server 02...");
            server.start(); // 启动服务
            System.out.println("WebSocket server started at ws://localhost:8083/ws");
            System.out.println("Press Enter to stop the server...");
            System.in.read(); // 按回车键停止服务
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            server.stop();
        }
    }
}
